/*            Copyright(c) 2006-2008 Dave Sexton           *
 * http://www.codeplex.com/DocProject                      *
 * http://www.codeplex.com/DocProject/Project/License.aspx *
 ***********************************************************/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using VSLangProj80;
using System.IO;
using DaveSexton.Controls;
using DaveSexton.DocProject.Sandcastle.ContentManagement;

namespace DaveSexton.DocProject.Sandcastle
{
	public sealed partial class CreateSharedContentControl : UserControl
	{
		#region Public Properties
		[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public XmlContentDocumentsEditor Editor
		{
			get
			{
				return editor;
			}
		}
		#endregion

		#region Private / Protected
		#endregion

		#region Constructors
		/// <summary>
		/// Constructs a new instance of the <see cref="CreateSharedContentControl" /> class.
		/// </summary>
		public CreateSharedContentControl(XmlContentManager manager)
			: this()
		{
			editor.Importer = manager.Importer;
			editor.DisplayManager = manager.DisplayManager;
			editor.Documents = manager.Documents;
		}

		/// <summary>
		/// Constructs a new instance of the <see cref="CreateSharedContentControl" /> class.
		/// </summary>
		private CreateSharedContentControl()
		{
			InitializeComponent();
		}
		#endregion

		#region Event Handlers
		protected override void OnVisibleChanged(EventArgs e)
		{
			if (Visible)
			{
				// For some reason hitting enter on the keyboard will sometimes cause the Next button to be 
				// clicked in the wizard even if the text cursor is in the HtmlEditor, blinking and all :)
				// The work-around is to force the focus away from the Next button immediately.

				editor.Focus();
			}

			base.OnVisibleChanged(e);
		}
		#endregion
	}
}
